<template>
  <view class="wrap">
    <web-view :src="link" @message="postMessageFun"></web-view>
  </view>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      link:
        'https://minio.wskjwl.com/document/driver-sign.html?t=' +
        new Date().getTime(),
    }
  },
  onLoad() {
    this.getInfo()
  },

  methods: {
    async getInfo() {
      const { code, result, message } = await this.$u.get(
        '/freight-business/freightDriver/driver/detail'
      )
      const { result: userInfo } = await this.$u.get(
        '/freight-business/get/userInfo'
      )
      const data = {}
      if (code == '0') {
        data.driverName = result.driverName
        data.certificateNo = result.certificateNo
        data.driverPhone = result.driverPhone
        data.ssqAccount = userInfo.ssqAccount
        this.link =
          this.link + '&data=' + encodeURIComponent(JSON.stringify(data))
        console.log(' this.link', this.link)
        plus.storage.setItem('data', '' + JSON.stringify(data))
      }
    },
    // 接收网页发送的信息
    postMessageFun(e) {
      console.log('接收到信息', e)
    },
  },
}
</script>
<style lang="scss" scoped></style>
